package day3;

import java.util.Scanner;

public class demo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
            System.out.println("选择购买的商品号：");
            System.out.println("1.T-Shirt\t 2.网球鞋\t 3.网球拍\t");
            System.out.println("********************************");
            String yn="";
            String name="";
            double price=0;
            int num=0;
            int money=0;
            do{
            System.out.print("请输入商品编号：");
            int choice = sc.nextInt();
            System.out.println("商品数量：");
            num = sc.nextInt();
            switch (choice) {
                case 1:name="T-Shirt";price=245.0;break;
                case 2:name="网球鞋";price=225.0;break;
                case 3:name="网球拍";price=325.0;break;
                default:name="未购买";price=0.0;break;
            }
            System.out.println(name+"$"+price+"\t"+"数量"+num+'\t'+"合计$"+num*price);
            System.out.println("是否继续(Y/N)");
            yn = sc.next();
            }while (yn.equals("Y"));
            System.out.println("折扣：0.8");
            System.out.println("应付金额:"+num*price*0.8);
            do {
                System.out.print("实付金额:");
                money = sc.nextInt();
            }while (money<num*price);
        System.out.println("找钱:" + (money - num * price * 0.8));
    }
}
